package com.jrui.www.t7manager;

import com.alibaba.fastjson.JSONArray;
import com.jrui.www.t7manager.constant.T7Set;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by try on 2019/5/23.
 */

public class MainActivityCfg {
    private Map<String, List<CardSettingBean>> router = new LinkedHashMap();

    private MainActivityCfg() {
//        初始化设置
        String VideoCodingJSON = "[{\"displayName\":\"图像模式\",\"type\":\"Enumeration\",\"defaultValue\":\"0\",\"enumEntry\":[{\"displayName\":\"流畅模式\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"高质量模式\",\"type\":\"String\",\"value\":\"1\"}],\"accessMode\":\"RW\"},{\"displayName\":\"系统码率(kbps)\",\"type\":\"Integer\",\"PMin\":\"64\",\"PMax\":\"1000\",\"accessMode\":\"RW\",\"unit\":\"kbps\"},{\"displayName\":\"视频源选择\",\"type\":\"Enumeration\",\"enumEntry\":[{\"displayName\":\"外接摄像头\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"内置摄像头\",\"type\":\"String\",\"value\":\"1\"}],\"accessMode\":\"RW\"},{\"displayName\":\"视频编码码率实时统计\",\"type\":\"Float\",\"accessMode\":\"RO\",\"unit\":\"kbps\"},{\"displayName\":\"视频编码帧率实时统计\",\"type\":\"Float\",\"accessMode\":\"RO\",\"unit\":\"fps\"}]";
        List<CardSettingBean> VideoCoding = JSONArray.parseArray(VideoCodingJSON, CardSettingBean.class);
        router.put("视频编码设置", VideoCoding);

        String SoundCodingJSON = "[{\"displayName\":\"编码开关\",\"type\":\"Enumeration\",\"enumEntry\":[{\"displayName\":\"打开\",\"type\":\"String\",\"value\":\"打开\"},{\"displayName\":\"关闭\",\"type\":\"String\",\"value\":\"关闭\"}],\"accessMode\":\"RW\"},{\"displayName\":\"编码音量(dB)\",\"type\":\"Integer\",\"defaultValue\":\"0\",\"PMin\":\"-24\",\"PMax\":\"24\",\"accessMode\":\"RW\",\"unit\":\"dB\"},{\"displayName\":\"编码格式\",\"type\":\"Enumeration\",\"defaultValue\":\"G.729a\",\"enumEntry\":[{\"displayName\":\"G.711\",\"type\":\"String\",\"value\":\"G.711\"},{\"displayName\":\"G.729a\",\"type\":\"String\",\"value\":\"G.729a\"}],\"accessMode\":\"RW\",},{\"displayName\":\"音频编码码率实时统计\",\"type\":\"Float\",\"accessMode\":\"RO\",\"unit\":\"kbps\"}]";
        List<CardSettingBean> SoundCoding = JSONArray.parseArray(SoundCodingJSON, CardSettingBean.class);
        router.put("音频编码设置", SoundCoding);

        String SendPortJSON = "[{\"displayName\":\"发包协议\",\"type\":\"Enumeration\",\"defaultValue\":\"1\",\"enumEntry\":[{\"displayName\":\"LTP\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"RTP 聚合\",\"type\":\"String\",\"value\":\"1\"},{\"displayName\":\"RTP 非聚合\",\"type\":\"String\",\"value\":\"2\"}],\"accessMode\":\"RW\"},{\"displayName\":\"视频负载类型\",\"type\":\"Integer\",\"defaultValue\":\"98\",\"PMin\":\"0\",\"PMax\":\"127\",\"accessMode\":\"RW\"},{\"displayName\":\"音频负载类型\",\"type\":\"Integer\",\"defaultValue\":\"97\",\"PMin\":\"0\",\"PMax\":\"127\",\"accessMode\":\"RW\"},{\"displayName\":\"发送接口\",\"type\":\"Enumeration\",\"defaultValue\":\"0\",\"enumEntry\":[{\"displayName\":\"USB\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"网口\",\"type\":\"String\",\"value\":\"1\"}],\"accessMode\":\"RW\"}]";
        List<CardSettingBean> SendPort = JSONArray.parseArray(SendPortJSON, CardSettingBean.class);
        router.put("发送接口设置", SendPort);

        String VideoEncodingJSON = "[{\"displayName\":\"解码控制\",\"type\":\"Enumeration\",\"defaultValue\":\"0\",\"enumEntry\":[{\"displayName\":\"打开\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"关闭\",\"type\":\"String\",\"value\":\"1\"}],\"accessMode\":\"RW\"},{\"displayName\":\"视频解码码率实时统计\",\"type\":\"Integer\",\"accessMode\":\"RO\",\"unit\":\"kbps\"},{\"displayName\":\"视频解码丢包数统计\",\"type\":\"Integer\",\"accessMode\":\"RO\"},{\"displayName\":\"视频解码分辨率\",\"type\":\"String\",\"accessMode\":\"RO\"}]";
        List<CardSettingBean> VideoEncoding = JSONArray.parseArray(VideoEncodingJSON, CardSettingBean.class);
        router.put("视频解码设置", VideoEncoding);

        String SoundEncodingJSON = "[{\"displayName\":\"解码开关\",\"type\":\"Enumeration\",\"enumEntry\":[{\"displayName\":\"打开\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"关闭\",\"type\":\"String\",\"value\":\"1\"}],\"accessMode\":\"RW\"},{\"displayName\":\"解码音量(dB)\",\"type\":\"Integer\",\"PMin\":\"-24\",\"PMax\":\"24\",\"accessMode\":\"RW\",\"unit\":\"dB\"},{\"displayName\":\"解码格式\",\"type\":\"Enumeration\",\"enumEntry\":[{\"displayName\":\"G.711\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"G.729a\",\"type\":\"String\",\"value\":\"1\"}],\"accessMode\":\"RW\"},{\"displayName\":\"音频解码丢包数统计\",\"type\":\"Integer\",\"accessMode\":\"RO\"}]";
        List<CardSettingBean> SoundEncoding = JSONArray.parseArray(SoundEncodingJSON, CardSettingBean.class);
        router.put("音频解码设置", SoundEncoding);

        String ReceivePortJSON = "[{\"displayName\":\"码流接收开关\",\"type\":\"Enumeration\",\"enumEntry\":[{\"displayName\":\"打开\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"关闭\",\"type\":\"String\",\"value\":\"1\"}],\"accessMode\":\"RW\"},{\"displayName\":\"解包协议\",\"type\":\"Enumeration\",\"enumEntry\":[{\"displayName\":\"LTP\",\"type\":\"String\",\"value\":\"0\"},{\"displayName\":\"RTP 聚合\",\"type\":\"String\",\"value\":\"1\"},{\"displayName\":\"RTP 非聚合\",\"type\":\"String\",\"value\":\"2\"}],\"accessMode\":\"RW\"}]";
        List<CardSettingBean> ReceivePort = JSONArray.parseArray(ReceivePortJSON, CardSettingBean.class);
        router.put("接收接口设置", ReceivePort);

        router.put("启动视频传输", new ArrayList<CardSettingBean>());


        router.put("关于系统", null);
    }

    private static class SingletonInstance {
        private static final MainActivityCfg INSTANCE = new MainActivityCfg();
    }

    public static MainActivityCfg getInstance() {
        return SingletonInstance.INSTANCE;
    }

    public Map<String, List<CardSettingBean>> getRouter() {
        return router;
    }
}
